package com.umeng.soexample.mvp.view.adapter;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.umeng.soexample.R;
import com.umeng.soexample.bean.BrandListEntity;

import java.util.List;

public class BrandAdapter extends BaseMultiItemQuickAdapter<BrandListEntity, BaseViewHolder> {

    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    public BrandAdapter(List<BrandListEntity> data) {
        super(data);
        addItemType(1, R.layout.item_brand_lettes);
        addItemType(2, R.layout.item_brand_child);
    }

    @Override
    protected void convert(BaseViewHolder helper, BrandListEntity item) {
        if (helper.getItemViewType() == 1){
            helper.setText(R.id.tv_item_brand_letters, item.brand_letter);
        }else if (helper.getItemViewType() == 2){
            helper.setText(R.id.tv_item_brand_name, item.brand_name);
        }
    }
}
